1907A - Rook - CodeForces Solution


implementation

Please click on ads to support us..

C++ Code:

#include <bits/stdc++.h>
#include <algorithm>
#define ll long long
#define dl double
#define MOfIDA                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

using namespace std;

int main()
{
    MOfIDA;

    ll test_case;
    cin >> test_case;

    while (test_case--)
    {
        char a;
        int b;
        cin >> a >> b;

        for (int i = 1; i <= 8; i++)
        {
            if (i == b)
                continue;

            cout << a << i << "\n";
        }
        for (int i = 1; i <= 8; i++)
        {
            if ((char)(i - 1 + 'a') == a)
                continue;

            cout << (char)(i - 1 + 'a') << b << "\n";
        }
    }
}


Comments

Submit
1 Comments
  • 28/2/2024 12:17 - Asia/Calcutta

#include <bits/stdc++.h> #include <algorithm> #define ll long long #define dl double #define MOfIDA \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); using namespace std; int main() { MOfIDA; ll test_case; cin >> test_case; while (test_case--) { char a; int b; cin >> a >> b; for (int i = 1; i <= 8; i++) { if (i == b) continue; cout << a << i << "\n"; } for (int i = 1; i <= 8; i++) { if ((char)(i - 1 + 'a') == a) continue; cout << (char)(i - 1 + 'a') << b << "\n"; } } }


More Questions

1359A - Berland Poker
459A - Pashmak and Garden
1327B - Princesses and Princes
1450F - The Struggling Contestant
1399B - Gifts Fixing
1138A - Sushi for Two
982C - Cut 'em all
931A - Friends Meeting
1594A - Consecutive Sum Riddle
1466A - Bovine Dilemma
454A - Little Pony and Crystal Mine
2A - Winner
1622B - Berland Music
1139B - Chocolates
1371A - Magical Sticks
1253A - Single Push
706B - Interesting drink
1265A - Beautiful String
214A - System of Equations
287A - IQ Test
1108A - Two distinct points
1064A - Make a triangle
1245C - Constanze's Machine
1005A - Tanya and Stairways
1663F - In Every Generation
1108B - Divisors of Two Integers
1175A - From Hero to Zero
1141A - Game 23
1401B - Ternary Sequence
598A - Tricky Sum